static public $cookie_name = 'taeluf_login'; The key in $_COOKIE['key'] that the login code is stored in
public $cookie_expiry = 15552000; Number of seconds before a new cookie expires
public $registration_expiry = 432000;
public $password_reset_expiry = 86400;
public $is_logged_in = false;
public string $email; email address of user
public int $id = -1;
public bool $is_active = false;
public array $queries = []; Array of query strings identifiable by key. Generated by LilSql (of LilDb package)
Methods
public function __construct($pdo)
public function from_row(array $row) Set values from a database row
public function is_logged_in():bool returns true/false whether logged in or not.
public function set_login_cookie($code) Set the login cookie code via setcookie() & also set it to $_COOKIE
public function logout() Change $user->is_logged_in to false. setcookie() to delete the cookie. de-activate the cookie key in the database
public function password_login(string $password) Get a login cookie after validating the password. You must call $this->set_login_cookie($code) to actually send the cookie to the browser. Or the setcookie() function if you wish to customize it
public function activate(string $code):bool Activate a user
public function new_code(string $type): string Generate a new cryptographically secure code (& insert into database)
public function register(string $password)
public function new_password(string $password, string $code): bool
public function is_registered():bool Checks if a user has registered for the site
public function is_active():bool Check if a user is active (clicked the link in the confirmation email)